package pl.jad.database.table.column;

import pl.jad.database.table.Table;

/**
 * Kolumna z nazwa klasy
 *
 */
public class ClassTableColumn extends PrimitiveTableColumn {
	/**
	 * Field used only for creating proper column type
	 */
	// FIXME: moze byc konflikt z polem zapisywanych klas
	protected String ___class___;
	
	public ClassTableColumn(Table table) throws Exception {
		super(table, ClassTableColumn.class.getDeclaredField("___class___"));
	}
	
	public String getSqlType() {
		return super.getSqlType() + " NOT NULL";
	}
	
	// this field does not exists in object
	public String getSqlFieldValue(Object object) throws Exception {
		return "'" + object.getClass().getName() + "'";
	}
}
